Skip to content

Move HTTP integration configuration to the UI#170321

Closed
MindFreeze wants to merge 7 commits into
home-assistant:devfrom
MindFreeze:http-config-ui
Closed

Move HTTP integration configuration to the UI#170321
MindFreeze wants to merge 7 commits into
home-assistant:devfrom
MindFreeze:http-config-ui

Conversation

@MindFreeze
Copy link
Copy Markdown
Member

@MindFreeze MindFreeze commented May 11, 2026

Proposed change

Moves the HTTP integration's configuration out of configuration.yaml and into a UI form under Settings > System > Network. Existing YAML is imported on first start and a repair issue prompts the user to remove the http: block. Stored config that fails validation at startup falls back to safe defaults so users aren't locked out.

This is the first step toward dropping the hard dependency on port 8123 and supporting alternative network setups (ports 80/443, multiple instances, etc.).

Implementation

  • New Store (http.config) for the user-managed config, kept separate from the existing STORAGE_KEY = "http" recovery snapshot.
  • http/config/get and http/config/update WebSocket commands (admin-only).
  • Boot flow: on first start, validate YAML via the existing HTTP_SCHEMA, persist, raise deprecated_yaml. On subsequent starts, the store wins over YAML and the repair stays until YAML is removed. Stored config that no longer validates falls back to defaults with a http_failed_to_start repair.
  • breaks_in_ha_version="2027.6.0"

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant
Copy link
Copy Markdown
Contributor

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (http) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of http can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign http Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR begins migrating the HTTP integration’s configuration from configuration.yaml to a UI-managed configuration, backed by persistent storage and exposed via admin-only WebSocket commands.

Changes:

  • Add a dedicated Store (http.config) for user-managed HTTP configuration and wire it into the HTTP integration startup flow.
  • Introduce admin-only WebSocket commands to read/update the stored HTTP config.
  • Add new Repairs issues/translations and expand test coverage for storage migration and the WebSocket API.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
homeassistant/components/http/__init__.py Loads/persists user config from storage, imports YAML on first run, falls back on invalid stored config, registers WS commands.
homeassistant/components/http/storage.py Adds the http.config Store wrapper and serialization helper for persisted config.
homeassistant/components/http/websocket_api.py Implements http/config/get and http/config/update admin WebSocket commands.
homeassistant/components/http/issue.py Adds Repairs issue helpers and defines the deprecation break version.
homeassistant/components/http/strings.json Adds translations for the new Repairs issues.
tests/components/http/test_storage.py Tests YAML→store import, defaults initialization, stored-over-YAML precedence, and invalid stored fallback behavior.
tests/components/http/test_websocket_api.py Tests WebSocket get/update behavior and admin authorization.
tests/components/http/test_init.py Updates expectations for new deprecation issue creation when YAML http: config is present.

Comment thread homeassistant/components/http/storage.py
Comment thread homeassistant/components/http/storage.py
Copilot AI review requested due to automatic review settings May 12, 2026 06:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Comment thread homeassistant/components/http/websocket_api.py Outdated
Comment thread homeassistant/components/http/issue.py
Comment thread homeassistant/components/http/__init__.py
Comment thread homeassistant/components/http/storage.py
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 12, 2026 06:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Comment thread tests/components/http/test_websocket_api.py Outdated
Comment thread tests/components/http/test_storage.py Outdated
Comment thread homeassistant/components/http/websocket_api.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 12, 2026 06:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment on lines +41 to +49
def async_get_store(hass: HomeAssistant) -> HttpConfigStore:
"""Return the user-config Store, private to the integration."""
return HttpConfigStore(
hass,
USER_CONFIG_STORAGE_VERSION,
USER_CONFIG_STORAGE_KEY,
private=True,
atomic_writes=True,
)
Comment on lines +52 to +64
store = async_get_store(hass)
existing = await store.async_load() or {}
merged = {**existing, **msg["config"]}

try:
validated = HTTP_SCHEMA(merged)
except vol.Invalid as err:
connection.send_error(msg["id"], websocket_api.ERR_INVALID_FORMAT, str(err))
return

stored = to_stored(cast(dict[str, Any], validated))
await store.async_save(stored)
connection.send_result(msg["id"], {"config": stored})
@edenhaus
Copy link
Copy Markdown
Member

Closing in favour of #171177

@edenhaus edenhaus closed this May 19, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators May 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants